package controller;

import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class Controller9 {
    @RequestMapping("/test9")
    @ResponseBody
    public String test9() {
        System.out.println("页面 9");
        return "{'name':'Sushi', 'age':'21'}";
    }

    @RequestMapping("/testGet")
    @ResponseBody
    public String testGet(@Validated String name, @Validated String location) {
        System.out.println("name:" + name + "  Location:" + location);
        return "{'name':'" + name + "', 'location':'" + location + "'}";
    }
    @RequestMapping(value = "/testPost", method = RequestMethod.POST)
    @ResponseBody
    public String testPost(@Validated String name, @Validated String location) {
        System.out.println("name:" + name + "  Location:" + location);
        return "{'name':'" + name + "', 'location':'" + location + "'}";
    }

}
